<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Login extends CI_Controller {

    /*public function __construct()
    {
        parent::__construct();
        if ($this->session->userdata('token'))
            redirect('manage');
    }*/

    public function index()
    {
        if ($this->input->post('name') && $this->input->post('pwd')) {
            if ($this->input->post('name')==='admin' && $this->input->post('pwd')==='admin123321') {
                $this->session->set_userdata(array('token'=>md5('token!@#$%^&*()')));
                redirect('manage');
            }else{
                redirect('manage');
            }
        }else{
            $this->load->view('login');
        }
    }
}
